package com.ews.onlineexchange.service;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.Query;

import com.ews.onlineexchange.model.Bulletin;
import com.ews.onlineexchange.model.BulletinDiscardRecord;
import com.ews.onlineexchange.model.DeterminedRecord;
import com.ews.onlineexchange.model.Notification;
import com.ews.onlineexchange.model.ServiceSupplier;
import com.ews.onlineexchange.model.Trade;
import com.ews.onlineexchange.model.User;

@Named
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class BulletinDiscardRecordService {

	
	@Inject
	EntityManager entityManager;
	private final static String GET_LIST_BY_BULLETIN_ID_HQL = " "
			+ "	SELECT rec								"
			+ "	FROM BulletinDiscardRecord rec			"
			+ "	WHERE rec.bulletinId = :bulletinId  	"
			+ "	ORDER BY rec.createDate desc  	";
	public List<BulletinDiscardRecord> getRecordsByBulletinId(String bulletinId) {
		return entityManager.createQuery(GET_LIST_BY_BULLETIN_ID_HQL)
				.setParameter("bulletinId", bulletinId)
				.getResultList();
	}
}
